package iu.test;

import org.testng.Assert;
import org.testng.annotations.Test;
import pages.HomePage;
import utils.LogTest;

/**
 * Created by Olga on 27.05.2014.
 */

public class SearchAndCompare extends OpenClose {

    @Test
    public void SearchShoes() {
        LogTest.info(" Test Started");
        HomePage page = new HomePage(driver);
        //page.waiting();

        String EccoShoes = "ECCO 242683(01163) 41";
        String AraShoes = "ARA 22-52518-01 36";

        String HTCPhone = "HTC 601n One mini Glacial Silver (4718487633890) UACRF";
        String lenovoPhone = "Lenovo S860 Titanium UACRF";

        String WatchCasio = "CASIO LDF-30-4AEF";
        String WatchCertina = "Certina C004-210";

        LogTest.info("Search Shoes");
        page.searchGood(EccoShoes);
        page.waitAddToCompare();
        page.addToCompare();

        page.clearSearchBox();

        page.searchGood(AraShoes);
        page.waitAddToCompare();
        page.addToCompare();
        page.waitToCompare();
        page.gotoComparison();
        page.waitForText(AraShoes);

        Assert.assertTrue(page.checkComparison(AraShoes));
        Assert.assertTrue(page.checkComparison(EccoShoes));

        LogTest.info("Search Mobile");
        page.gotoHomePage();

        page.searchGood(lenovoPhone);
        page.waitAddToCompare();
        page.addToCompare();
        page.clearSearchBox();

        page.searchGood(HTCPhone);
        page.waitAddToCompare();
        // page.waitForText(HTCPhone);
        page.addToCompare();
        page.waitToCompare();
        page.gotoComparison();
        page.waitForText(HTCPhone);

        Assert.assertTrue(page.checkComparison(HTCPhone));
        Assert.assertTrue(page.checkComparison(lenovoPhone));

        LogTest.info("Search Watch");
        page.gotoHomePage();

        page.searchGood(WatchCasio);
        page.waitAddToCompare();
        page.addToCompare();
        // page.waiting();
        page.clearSearchBox();

        page.searchGood(WatchCertina);
        page.waitAddToCompare();
        page.addToCompare();
        page.waitToCompare();
        page.gotoComparison();
        page.waitForText(WatchCertina);

        Assert.assertTrue(page.checkComparison(WatchCasio));
        Assert.assertTrue(page.checkComparison(WatchCertina));


    }
}
